<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width,user-scalable=0"/>
    <meta charset="UTF-8">
    <title>BD健身</title>
    <script src="__api__/js/fontSize.js"></script>
    <link rel="stylesheet" href="__api__/css/bootstrap.min.css">
    <link rel="stylesheet" href="__api__/css/reset.css">
    <link rel="stylesheet" href="__api__/css/my_main.css">
    <link rel="stylesheet" href="__api__/css/dropload.css">
    <style>
        body{
            background-image:url("__api__/images/login_back.jpg");
            background-repeat: no-repeat;
            background-size: cover;
            width: 100%;
            height: 100%;

        }

    </style>
</head>
<body ontouchstart=""  id="container">
<!--<header class="tabHead">-->
<!--<span class="active">我的收藏</span>-->
<!--<span>我的评价</span>-->
<!--<div class="sanjiao"></div>-->
<!--</header>-->
<div class="login">
    <div class="loginTitle">
        <div class="logo">
            <img src="__api__/images/logo.png">
        </div>
        <div class="title">
            <img src="__api__/images/bd_title.png">
        </div>
    </div>
    <div class="myLogin">
        <div class="container">
            <header class="tabHead">
                <a href="javascript:"> <span class="active">用户登录</span></a>
                <a href="__up__/api/User/shangjiaLogin"><span>商家登录</span></a>
                <b class="border"></b>
            </header>
        </div>

    </div>

    <div class="khfxWarp">
        <div class="container">
            <section class="form khfxPane" style="display:block">
                <div class="formLogin">


                    <form action="#" class="form-horizontal form_login" onsubmit="return false">
                        <div class="form-group">
                            <input class="form-control" type="tel" name="telphone" id='tel' placeholder="手机号" required>
                        </div>
                        <div class="form-group number">

                            <input class="form-control" type="text" name="code" placeholder="验证码" required>
                            <a href="javascript:" id="getcode"><span>获取验证码</span></a>


                        </div>
                        <div class="form-group loginBtn">
                            <button class="btn btn-primary" id="login">
                                <span>登录</span>
                            </button>
                        </div>
                    </form>
                     <a href="__up__/api/user/regis" class="reg pull-right">
                        <span>注册</span>
                    </a>
                    <div class="log-other">
                        <div class="pwd"><a href="__up__/api/user/login"><span>密码登陆</span></a></div>

                        <div class="forget"><a href="__up__/api/user/forgetPwd"><span>忘记密码</span></a></div>
                    </div>

            </section>
        </div>

    </div>

</div>

<script src="__assets__/js/jquery.min.js"></script>
<script src="__api__/js/bootstrap.min.js"></script>
<script src="__api__/js/khData.js"></script>
<script src="__assets__/layui.js"></script>
<script type="text/javascript">

//手机验证码登录

$(function(){
	$('#login').click(function(){
		var data=$("form").serialize();
		var url="__up__/api/user/Textlogin";
		//var url='/api/user/Textlogin';
		//console.log(data);
		var layer;
		layui.use('layer', function(){
			   layer = layui.layer;
			}); 
		$.post(url,data,function(res){
			 
			var obj=eval('('+ res +')');
			console.log(obj);
			var status=obj.status;
			var info=decodeURI(obj.info);
			if(obj.status==-1){
				layer.msg(info,{icon:5});
			}else if(status==400){
				
				layer.msg(info,{icon:5},function(){
					$('#tel').blur(function(){
						var layer;
						layui.use('layer', function(){
							   layer = layui.layer;
							}); 
						that=$('#tel');
						var telphone=that.val();
						var url='__up__/api/user/checkUserAccount';
						var data={telphone:telphone};
						$.get(url,data,function(res){
							var obj=sin(res);
							var status=obj.status;
							var info=obj.info;
							if(status==0){
								layer.msg(info,{icon:5},function(){
									window.location.href=obj.data;
								});
							}
							
						})
					});
				});
			}else{
				layer.msg(info,{icon:6},function(){
					window.location.href=obj.data;
				})
			}
		})
	});
	
	var  layer;
	layui.use('layer', function(){
		   layer = layui.layer;
});
	$('#getcode').click(function(){
		var url="__up__/api/user/getTextValidateCode";
		var telphone=$('#tel').val();
		 
		if(telphone.length==0){
			
			layer.msg('请填写手机号',{icon:6});
		}
		if(telphone.length!=11){
			layer.msg('请填写正确的手机号格式',{icon:5});
		}
		var data={telphone:telphone};
		$.get(url,data,function(res){
		var obj=sin(res);
		var status=obj.status;
		var info=obj.info;
		if(status==400){
			layer.msg(info,{icon:5});
		}else if(status==200){
			layer.msg(info,{icon:6});
		}else {
			layer.msg(info,{icon:5});
		}
		
		})
		//$.get(url,)
	});
	function sin(res){
		return eval('('+ res +')');
	}
	
	
});



</script>
</body>
</html>